package mayor.mq.producer.transaction;

import com.alibaba.rocketmq.client.producer.LocalTransactionExecuter;
import com.alibaba.rocketmq.client.producer.LocalTransactionState;
import com.alibaba.rocketmq.common.message.Message;

public class TransactionExcuterImpl implements LocalTransactionExecuter {
    public LocalTransactionState executeLocalTransactionBranch(Message msg, Object arg) {
        System.out.println("msg = " + new String(msg.getBody()));
        System.out.println("arg = " + arg);
        String tag = msg.getTags();
        if(tag.equals("Transaction1")) {
            System.out.println(" 这里处理业务变更 ");
            return LocalTransactionState.UNKNOW;
        }
        return  LocalTransactionState.COMMIT_MESSAGE;
    }
}
